package com.zhiwang.planet.util

import kotlinx.coroutines.delay

suspend fun <T> retryIO(retryCount: Int =2, delay: Long =200, block: suspend () -> T): T {

    repeat(retryCount - 1) {

        try {
            return block()
        } catch (e: Exception) {

        }

        delay(delay)
    }

    return block()
}